function getBlogList () {
    $.ajax({
        url : 'blog',
        method : 'get',
        success : function (body) {
            let blogs = $('.blogs')
            blogs.html('')
            for (let blog of body) {
                let blogDiv = $('<div></div>')
                blogDiv.attr("class", "blog");
                let titleDiv = $('<div></div>')
                titleDiv.text(blog.title)
                titleDiv.attr('class', 'title')
                blogDiv.append(titleDiv)
                let categoryDiv = $('<div style="width: auto; text-align: center; font-size: 14px; margin-bottom: 5px"></div>')
                categoryDiv.text(`分类：${blog.category}`)
                categoryDiv.attr('class', 'category')
                blogDiv.append(categoryDiv)
                let dateDiv = $('<div></div>')
                dateDiv.text(blog.postTime)
                dateDiv.attr('class', 'date')
                blogDiv.append(dateDiv)
                let contentDiv = $('<div></div>')
                contentDiv.text(blog.content)
                contentDiv.attr('class', 'desc')
                blogDiv.append(contentDiv)
                let a = $('<a></a>')
                a.attr('href', 'blog_content.html?blogId=' + blog.blogId)
                a.attr('class', 'detail')
                a.text('查看全文')
                blogDiv.append(a)
                blogDiv.append($('<hr>'))
                blogs.append(blogDiv)
            }

        },
        error : function () {
            alert('获取博客列表失败')
        }
    })
}
getBlogList()